<template>
  <div>
    <el-row>
      <el-col :span="18" class="marginTop paddingLfet colorwhite fontSize">
        年龄数据
      </el-col>
      <el-col :span="6" class="jend marginTop paddingRight colorwhite fontSize">
        详情>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <div id="main2" :style="chartStyle"></div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  data() {
    return { height: 31 };
  },
  mounted() {
    let WW = window.innerWidth;
    if (WW < 1300) {
      this.height = 32;
    }
    setTimeout(() => {
      this.echarts111();
    }, 100);
  },
  computed: {
    chartStyle() {
      return `width: 100%; height: ${this.height}vh`;
    },
  },
  methods: {
    echarts111() {
      var myChart = echarts.init(document.getElementById("main2"));
      var option;
      // 指定图表的配置项和数据
      option = {
        // title: {
        //   text: "ECharts 入门示例",
        // },
        tooltip: {},
        legend: {
          data: ["销量"],
        },
        xAxis: {
          data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
        },
        yAxis: {},
        series: [
          {
            name: "销量",
            type: "bar",
            data: [5, 20, 36, 10, 10, 20],
          },
        ],
      };

      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    },
  },
};
</script>

<style lang="scss" scoped>
.fontSize {
  font-size: 18px;
}
.colorwhite {
  color: white;
}
.paddingLfet {
  padding-left: 2vh;
}
.paddingRight {
  padding-right: 2vh;
}
.marginTop {
  margin-top: 2vh;
}
.jend {
  display: flex;
  justify-content: flex-end;
}
</style>